Produced by Araxis Merge on 2023-07-12 04:42:38 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Porto v4.0.5/Theme Files/Porto Theme/app/code/Smartwave/Dailydeals/Controller/Adminhtml/Dailydeal | InlineEdit.php | 2018-03-14 03:43:54 +0000 |
| 2 | Porto v4.0.6/Theme Files/Porto Theme/app/code/Smartwave/Dailydeals/Controller/Adminhtml/Dailydeal | InlineEdit.php | 2023-06-11 04:29:25 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 180 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 1 | 1 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | <?php | 1 | <?php | |||
| 2 | namespace Smartwave\Dailydeals\Controller\Adminhtml\Dailydeal; | 2 | namespace Smartwave\Dailydeals\Controller\Adminhtml\Dailydeal; | |||
| 3 | 3 | |||||
| 4 | abstract class InlineEdit extends \Magento\Backend\App\Action | 4 | ||||
| 5 | { | 5 | { | |||
| 6 | /** | 6 | /** | |||
| 7 | * JSON Factory | 7 | * JSON Factory | |||
| 8 | * | 8 | * | |||
| 9 | * @var \Magento\Framework\Controller\Result\JsonFactory | 9 | * @var \Magento\Framework\Controller\Result\JsonFactory | |||
| 10 | */ | 10 | */ | |||
| 11 | protected $jsonFactory; | 11 | protected $jsonFactory; | |||
| 12 | 12 | |||||
| 13 | /** | 13 | /** | |||
| 14 | * Dailydeal Factory | 14 | * Dailydeal Factory | |||
| 15 | * | 15 | * | |||
| 16 | * @var \Smartwave\Dailydeals\Model\DailydealFactory | 16 | * @var \Smartwave\Dailydeals\Model\DailydealFactory | |||
| 17 | */ | 17 | */ | |||
| 18 | protected $dailydealFactory; | 18 | protected $dailydealFactory; | |||
| 19 | 19 | |||||
| 20 | /** | 20 | /** | |||
| 21 | * constructor | 21 | * constructor | |||
| 22 | * | 22 | * | |||
| 23 | * @param \Magento\Framework\Controller\Result\JsonFactory $jsonFactory | 23 | * @param \Magento\Framework\Controller\Result\JsonFactory $jsonFactory | |||
| 24 | * @param \Smartwave\Dailydeals\Model\DailydealFactory $dailydealFactory | 24 | * @param \Smartwave\Dailydeals\Model\DailydealFactory $dailydealFactory | |||
| 25 | * @param \Magento\Backend\App\Action\Context $context | 25 | * @param \Magento\Backend\App\Action\Context $context | |||
| 26 | */ | 26 | */ | |||
| 27 | public function __construct( | 27 | public function __construct( | |||
| 28 | \Magento\Framework\Controller\Result\JsonFactory $jsonFactory, | 28 | \Magento\Framework\Controller\Result\JsonFactory $jsonFactory, | |||
| 29 | \Smartwave\Dailydeals\Model\DailydealFactory $dailydealFactory, | 29 | \Smartwave\Dailydeals\Model\DailydealFactory $dailydealFactory, | |||
| 30 | \Magento\Backend\App\Action\Context $context | 30 | \Magento\Backend\App\Action\Context $context | |||
| 31 | ) { | 31 | ) { | |||
| 32 | ||||||
| 33 | $this->jsonFactory = $jsonFactory; | 32 | $this->jsonFactory = $jsonFactory; | |||
| 34 | $this->dailydealFactory = $dailydealFactory; | 33 | $this->dailydealFactory = $dailydealFactory; | |||
| 35 | parent::__construct($context); | 34 | parent::__construct($context); | |||
| 36 | } | 35 | } | |||
| 37 | 36 | |||||
| 38 | /** | 37 | /** | |||
| 39 | * @return \Magento\Framework\Controller\ResultInterface | 38 | * @return \Magento\Framework\Controller\ResultInterface | |||
| 40 | */ | 39 | */ | |||
| 41 | public function execute() | 40 | public function execute() | |||
| 42 | { | 41 | { | |||
| 43 | /** @var \Magento\Framework\Controller\Result\Json $resultJson */ | 42 | /** @var \Magento\Framework\Controller\Result\Json $resultJson */ | |||
| 44 | $resultJson = $this->jsonFactory->create(); | 43 | $resultJson = $this->jsonFactory->create(); | |||
| 45 | $error = false; | 44 | $error = false; | |||
| 46 | $messages = []; | 45 | $messages = []; | |||
| 47 | $postItems = $this->getRequest()->getParam('items', []); | 46 | $postItems = $this->getRequest()->getParam('items', []); | |||
| 48 | if (!($this->getRequest()->getParam('isAjax') && count($postItems))) { | 47 | if (!($this->getRequest()->getParam('isAjax') && count($postItems))) { | |||
| 49 | return $resultJson->setData([ | 48 | return $resultJson->setData([ | |||
| 50 | 'messages' => [__('Please correct the data sent.')], | 49 | 'messages' => [__('Please correct the data sent.')], | |||
| 51 | 'error' => true, | 50 | 'error' => true, | |||
| 52 | ]); | 51 | ]); | |||
| 53 | } | 52 | } | |||
| 54 | foreach (array_keys($postItems) as $dailydealId) { | 53 | foreach (array_keys($postItems) as $dailydealId) { | |||
| 55 | /** @var \Smartwave\Dailydeals\Model\Dailydeal $dailydeal */ | 54 | /** @var \Smartwave\Dailydeals\Model\Dailydeal $dailydeal */ | |||
| 56 | $dailydeal = $this->dailydealFactory->create()->load($dailydealId); | 55 | $dailydeal = $this->dailydealFactory->create()->load($dailydealId); | |||
| 57 | try { | 56 | try { | |||
| 58 | $dailydealData = $postItems[$dailydealId];//todo: handle dates | 57 | $dailydealData = $postItems[$dailydealId];//todo: handle dates | |||
| 59 | $dailydeal->addData($dailydealData); | 58 | $dailydeal->addData($dailydealData); | |||
| 60 | $dailydeal->save(); | 59 | $dailydeal->save(); | |||
| 61 | } catch (\Magento\Framework\Exception\LocalizedException $e) { | 60 | } catch (\Magento\Framework\Exception\LocalizedException $e) { | |||
| 62 | $messages[] = $this->getErrorWithDailydealId($dailydeal, $e->getMessage()); | 61 | $messages[] = $this->getErrorWithDailydealId($dailydeal, $e->getMessage()); | |||
| 63 | $error = true; | 62 | $error = true; | |||
| 64 | } catch (\RuntimeException $e) { | 63 | } catch (\RuntimeException $e) { | |||
| 65 | $messages[] = $this->getErrorWithDailydealId($dailydeal, $e->getMessage()); | 64 | $messages[] = $this->getErrorWithDailydealId($dailydeal, $e->getMessage()); | |||
| 66 | $error = true; | 65 | $error = true; | |||
| 67 | } catch (\Exception $e) { | 66 | } catch (\Exception $e) { | |||
| 68 | $messages[] = $this->getErrorWithDailydealId( | 67 | $messages[] = $this->getErrorWithDailydealId( | |||
| 69 | $dailydeal, | 68 | $dailydeal, | |||
| 70 | __('Something went wrong while saving the Dailydeal.') | 69 | __('Something went wrong while saving the Dailydeal.') | |||
| 71 | ); | 70 | ); | |||
| 72 | $error = true; | 71 | $error = true; | |||
| 73 | } | 72 | } | |||
| 74 | } | 73 | } | |||
| 75 | return $resultJson->setData([ | 74 | return $resultJson->setData([ | |||
| 76 | 'messages' => $messages, | 75 | 'messages' => $messages, | |||
| 77 | 'error' => $error | 76 | 'error' => $error | |||
| 78 | ]); | 77 | ]); | |||
| 79 | } | 78 | } | |||
| 80 | 79 | |||||
| 81 | /** | 80 | /** | |||
| 82 | * Add Dailydeal id to error message | 81 | * Add Dailydeal id to error message | |||
| 83 | * | 82 | * | |||
| 84 | * @param \Smartwave\Dailydeals\Model\Dailydeal $dailydeal | 83 | * @param \Smartwave\Dailydeals\Model\Dailydeal $dailydeal | |||
| 85 | * @param string $errorText | 84 | * @param string $errorText | |||
| 86 | * @return string | 85 | * @return string | |||
| 87 | */ | 86 | */ | |||
| 88 | protected function getErrorWithDailydealId(\Smartwave\Dailydeals\Model\Dailydeal $dailydeal, $errorText) | 87 | protected function getErrorWithDailydealId(\Smartwave\Dailydeals\Model\Dailydeal $dailydeal, $errorText) | |||
| 89 | { | 88 | { | |||
| 90 | return '[Dailydeal ID: ' . $dailydeal->getId() . '] ' . $errorText; | 89 | return '[Dailydeal ID: ' . $dailydeal->getId() . '] ' . $errorText; | |||
| 91 | } | 90 | } | |||
| 92 | } | 91 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.